const Mock = require('mockjs');

const List = [];
const count = 7;

for (let i = 0; i < count; i++) {
    List.push(Mock.mock({
        'roleId': i + 1,
        'roleName': '@cword(2,3)管理员',
        'roleRemark': '@ctitle',
        'createdTime': '@date("yyyy-MM-dd hh:mm:ss")'
    }));
}

module.exports = [
    {
        url: '/vue-admin-template/role/search',
        type: 'post',
        response: config => {
            const { page = 1, limit = 99999 } = config.body;
            const pageList = List.filter((item, index) => index < limit * page && index >= limit * (page - 1));

            return {
                code: 200,
                data: pageList,
                success: true,
                page: page,
                pages: Math.ceil(List.length / limit),
                count: List.length
            };
        }
    },

    {
        url: '/vue-admin-template/article/create',
        type: 'post',
        response: _ => {
            return {
                code: 200,
                data: 'success'
            };
        }
    },

    {
        url: '/vue-admin-template/article/update',
        type: 'post',
        response: _ => {
            return {
                code: 200,
                data: 'success'
            };
        }
    }
];

